CS50 PSet 2 Solution